package com.cx.service.impl;

import com.cx.pojo.Order;
import com.cx.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@org.springframework.stereotype.Service
public class Service {
    @Autowired
    RestTemplate restTemplate;

    /**
     *
     * @param user 登录即把数据通过注册中心发送到酒店模块
     * @return
     */
    public User sendUserInfo(User user){
        System.out.println("执行到了这一步");
        return restTemplate.postForEntity("http://BrandAndHotel/isauser",user, User.class).getBody();
    }
    public void deleteUser(){
        restTemplate.delete("http://BrandAndHotel/deleteUser");
    }
    public List<Order> getOrderInfoByUserName(String userName){
        System.out.println("男女男");
        return restTemplate.getForEntity("http://Order/getOrderInfoByUserName",List.class,userName).getBody();
    }
}